package fr.aracore.domotique.zapi.model.impl;

import fr.aracore.domotique.zapi.model.Sensor;

public class XseSensorDescriptor extends SensorDescriptor{

	@Override
	public String tag() {
		return "xse";
	}

	@Override
	public String libelle() {
		return "X10Secure";
	}

	@Override
	public String stateDescriptionForSensor(Sensor sensor) {
		String lcContent=sensor.value().substring(2);
		long lcValue=Long.parseLong(lcContent)&0xff;
		int value=(int)lcValue;
		
		String lcResult="";
		switch (value)
		{
		case 0x20:
		case 0x30:
			lcResult = "ALERT";
			break;
		case 0x21:
		case 0x31:
			lcResult = "NORMAL";
			break;
		case 0x40:
			lcResult = "ARM AWAY (max)";
			break;
		case 0x41:
		case 0x61:
			lcResult = "DISARM";
			break;
		case 0x42:
			lcResult = "SEC. LIGHT ON";
			break;
		case 0x43:
			lcResult = "SEC. LIGHT OFF";
			break;
		case 0x44:
			lcResult = "PANIC";
			break;
		case 0x50:
			lcResult = "ARM HOME";
			break;
		case 0x60:
			lcResult = "ARM";
			break;
		case 0x62:
			lcResult = "LIGHTS ON";
			break;
		case 0x63:
			lcResult = "LIGHTS OFF";
			break;
		case 0x70:
			lcResult = "ARM HOME (min)";
			break;
		}
		return lcResult;
	}

}
